<?php
    require('init.php');
    require('header.php');
    
    $clients = Client::getClients();
    echo '<div id="gestion"  class= "container_12">';
    echo '<a class="grid_4 alpha" href="details_client.php">
    .     <img alt="#" src="../img/ajouter.png" title="Ajouter" class="btn_ajouter" width="30"/>
          Ajouter un nouveau client</a>';
    echo '</div>';
    echo    '<div class= "container_12">';
    echo    '<table class="grid_12" cellspacing="0">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Civilité</th>
                        <th>Nom</th>
                        <th>Login</th>
                        <th>E-mail</th>
                        <th>Profil</th>
                        <th>Actif</th>
                        <th>Gérer</th>
                    </tr>
                </thead>
                <tbody>';
    foreach($clients as $client) {
        $classe = "clientActif";
        if($client->getValide() == 0) {
            $classe = "clientInactif";
        }
        
        echo        '<tr class="'.$classe.'">
                        <td>
                            '.$client->getId().'
                        </td>
                        <td>
                            '.$client->getCivilite().'
                        </td>
                        <td>
                            '.$client.'
                        </td>
                        <td>
                            '.$client->getLogin().'
                        </td>
                        <td>
                            '.$client->getEmail().'
                        </td>
                        <td>
                            '.$client->getProfil().'
                        </td>
                        <td>
                            '.$client->getValide().'
                        </td>
                        <td>
                            <a href="details_client.php?id='.$client->getId().'">Gérer</a> 
                        </td>
                    </tr>';
    }
    echo        '</tbody>
            </table>
            </div>';
?>
